<template>
  <el-dialog title="提示" :visible="value" @close="close">
    <el-upload class="upload-demo" drag action="" :http-request="fileChange" multiple>
      <i class="el-icon-upload"></i>
      <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
      <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div>
    </el-upload>
    <span slot="footer" class="dialog-footer">
      <el-button>取 消</el-button>
    </span>
  </el-dialog>
</template>
<script>
import { uploadExcel } from "@/api/employee";

export default {
  name: 'importExcelTwo',
  props: {
    value: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {

    }
  },
  created () {
  },
  computed: {
  },
  methods: {
    async fileChange (e) {

      const file = e.file

      //发送文件给后端,一般都要用 FormData
      const formData = new FormData()
      formData.append('file', file)
      await uploadExcel(formData)


    },
    close () {
      this.$emit('input', false)
    }
  }
}
</script>
<style lang='less'  scoped>
</style>
